from database.database import Database
from model.dbmodel import DbTaskRecord


class TaskRecordsTable(Database):
    def __init__(self):
        self.table_name = "task_records"

    def insert(self, info: DbTaskRecord, commit=False):
        sql = self.get_insert_sql_from_obj(info, self.table_name)
        self.execute(sql)
        if commit:
            self.commit()
        return int(self.cursor.lastrowid)
